package com.ptmall.app.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import com.ptmall.app.R;
import com.ptmall.app.base.BaseMvpActivity;
import com.ptmall.app.net.HttpMethods;
import com.ptmall.app.view.TitleBarView;

/**
 * Created by Administrator on 2019/4/3.
 */

public class GzActivity extends BaseMvpActivity implements View.OnClickListener {

    RelativeLayout rel1,rel2,rel3,rel4,rel5;
    Intent intent;
    TitleBarView titleBarView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setView(R.layout.activity_gz);
    }

    @Override
    public void initViews() {
        titleBarView = (TitleBarView) findViewById(R.id.titlebar);
        rel1 = (RelativeLayout) findViewById(R.id.rel1);
        rel2 = (RelativeLayout) findViewById(R.id.rel2);
        rel3 = (RelativeLayout) findViewById(R.id.rel3);
        rel4 = (RelativeLayout) findViewById(R.id.rel4);
        rel5 = (RelativeLayout) findViewById(R.id.rel5);

        rel1.setOnClickListener(this);
        rel2.setOnClickListener(this);
        rel3.setOnClickListener(this);
        rel4.setOnClickListener(this);
        rel5.setOnClickListener(this);
    }

    @Override
    public void initEvents() {
        titleBarView.setOnTitleBarClickListener(new TitleBarView.TitleBarClickListener() {
            @Override
            public void leftClick() {
                finish();
            }

            @Override
            public void rightClick() {

            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.rel1:

                intent = new Intent(getContext(), WebActivity.class);
                intent.putExtra("title","用户协议");
                intent.putExtra("url", HttpMethods.BASE_URL+"Detail/deal");
                startActivity(intent);
                break;
            case R.id.rel2:

                intent = new Intent(getContext(), WebActivity.class);
                intent.putExtra("title","隐私政策");
                intent.putExtra("url", HttpMethods.BASE_URL+"Detail/yinsi");
                startActivity(intent);
                break;
            case R.id.rel3:

                intent = new Intent(getContext(), WebActivity.class);
                intent.putExtra("title","退换货政策");
                intent.putExtra("url", HttpMethods.BASE_URL+"Detail/tui_rule");
                startActivity(intent);
                break;
            case R.id.rel4:

                intent = new Intent(getContext(), WebActivity.class);
                intent.putExtra("title","配送规则");
                intent.putExtra("url", HttpMethods.BASE_URL+"Detail/rule");
                startActivity(intent);
                break;
            case R.id.rel5:

                intent = new Intent(getContext(), WebActivity.class);
                intent.putExtra("title","营业执照");
                intent.putExtra("url", HttpMethods.BASE_URL+"Detail/zhizhao");
                startActivity(intent);
                break;
        }
    }
}
